package com.cz.mydao.wrapper;

import lombok.Getter;
import java.util.List;

/**
 * @descriptions: 查询条件
 * @author: Joker.
 * @date: 2024/12/24 11:59
 * @version: 1.0
 */
@Getter
public class Condition {
    /**
     * 条件字段名
     */
    private final String field;

    /**
     * 条件单个字段值 如like, =, >, <
     */
    private  Object value;

    /**
     * 存储多个字段值 如 in, between
     */
    private List<Object> values;

    /**
     * 操作符，如 =, >, <, like between等
     */
    private final String operator;

    /**
     * 存储单值条件构造器
     * @param field 字段
     * @param value 单个值
     * @param operator 运算符
     */
    public Condition(String field, Object value, String operator) {
        this.field = field;
        this.value = value;
        this.operator = operator;
    }

    /**
     * 存储多值条件构造器
     * @param field 字段
     * @param values 多个值
     * @param operator 运算符
     */
    public Condition(String field, List<Object> values, String operator) {
        this.field = field;
        this.values = values;
        this.operator = operator;
    }
}

